package com.javaee.service.admin.impl;

import com.javaee.entity.Department;
import com.javaee.mapper.admin.DepartmentMapper;
import com.javaee.service.admin.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class DepartmentServiceImpl implements DepartmentService {
    @Autowired
    private DepartmentMapper departmentMapper;
    @Override
    public List<Department> findAll(int pageNum, int pageSize) {
        return departmentMapper.findAll(pageNum,pageSize);
    }

    @Override
    public Department findById(Integer id) {
        return departmentMapper.findById(id);
    }

    @Override
    public void save(Department department) {
        departmentMapper.insert(department);
    }

    @Override
    public void update(Department department) {
        departmentMapper.update(department);
    }

    @Override
    public void deleteById(Integer id) {
        departmentMapper.deleteById(id);
    }
    @Override
    public List<Department> findByName(String dName) {
        return departmentMapper.findByName(dName);
    }

    @Override
    public int selectCount() {
        return departmentMapper.selectCount();
    }
}
